<!doctype html>
<html>
<head>
<include file="Include:meta" />
<title>人员需求详情-目的地运营集团数据管理平台</title>
<include file="Include:style" />
<style>
	.form-item .input-label{ width: 160px !important; }
	.form-item .input-item{ padding-left: 160px; }
	.input-prompt{ display: block; color: #999; line-height: 18px }
	.w50{ width: 50px }
</style>
</head>
<body>
<include file="Include:header" />
<include file="Include:left" />
<div id="main">
	<div class="crumbs">
		<div class="crumbs-text">人员需求管理 > 人员需求详情</div>
	</div>
	<div id="content">
		<form action="__APP__/Hr/person_demand_edit" method="post" enctype="multipart/form-data">
			<input type="hidden" name="action" value="edit">
			<input type="hidden" name="id" value="{$result['id']}">
			<div class="form-main">
				<div class="form-title">人员需求详情({$result['order_number']})</div>
				<div class="form-item clearfix">
					<div class="item-float">
						<div class="input-label">申请职位</div>
						<div class="input-item">{$result['position_user']}</div>
					</div>
					<div class="item-float">
						<div class="input-label">申请人数</div>
						<div class="input-item">{$result['number']}</div>
					</div>
				</div>
				<div class="form-item clearfix">
					<div class="item-float">
						<div class="input-label">岗位职级</div>
						<div class="input-item">{$result['rank']}</div>
					</div>
					<div class="item-float">
						<div class="input-label">汇报对象</div>
						<div class="input-item">{$result['report_user']}</div>
					</div>
				</div>
				<div class="form-item clearfix">
					<div class="item-float">
						<div class="input-label">岗位所属部门</div>
						<div class="input-item">{$result['department_name']}</div>
					</div>
					<div class="item-float">
						<div class="input-label">是否关键岗位</div>
						<div class="input-item">{$result['is_position']}</div>
					</div>
				</div>
				<div class="form-item clearfix">
					<div class="item-float">
						<div class="input-label">申请部门</div>
						<div class="input-item">{$result['sq_department_name']}</div>
					</div>
					<div class="item-float">
						<div class="input-label">申请人</div>
						<div class="input-item">{$result['add_user']}</div>
					</div>
				</div>
				<div class="form-item clearfix">
					<div class="item-float">
						<div class="input-label">申请人岗位</div>
						<div class="input-item">{$result['sq_position_user']}</div>
					</div>
					<div class="item-float">
						<div class="input-label">申请日期</div>
						<div class="input-item">{$result['sq_date']}</div>
					</div>
				</div>
				<div class="form-item">
					<div class="input-label">申请原因</div>
					<div class="input-item">{$result['sq_remark']}</div>
				</div>
				<div class="form-table-item">
					<table class="table">
						<tr class="form-table-header Text_c">
							<td colspan="3">申请理由</td>
						</tr>
						<tr>
							<td width="280" class="title-box"><b>岗位职责简述及工作时间占比（%）</b></td>
							<td><if condition="$result['reason1'] eq NULL">无<else/>{$result['reason1']}</if></td>
							<td width="320">
								<b>是否后附材料</b>
								<span class="checkbox-item ml10 mr5"><if condition="$result['file1'] eq '否'">{$result['file1']}</if>
								<if condition="$result['file_url1'] neq NULL">
									{$result['file_name1']}<a href="{$result['file_url1']}" target="_blank" data-toggle="tooltip" data-placement="right" title="下载" class="ml5"><i class="glyphicon glyphicon-download-alt mr5"></i></a>
								</if>
								</span>
							</td>
						</tr>
						<tr>
							<td class="title-box"><b>岗位任职要求</b></td>
							<td>
								<if condition="$result['requir1'] eq NULL and $result['requir2'] eq NULL and $result['requir3'] eq NULL and $result['requir4'] eq NULL and $result['requir5'] eq NULL and $result['reason2'] eq NULL">
									无
								<else/>
									<if condition="$result['requir1'] neq NULL or $result['requir2'] neq NULL or $result['requir3'] neq NULL or $result['requir4'] neq NULL or $result['requir5'] neq NULL">
										<p>基本要求：</p>
										<p class="mb10">
										<if condition="$result['requir1'] neq NULL"><span class="mr10">学历：{$result['requir1']}</span></if>
										<if condition="$result['requir2'] neq NULL"><span class="mr10">专业：{$result['requir2']}</span></if>
										<if condition="$result['requir3'] neq NULL"><span class="mr10">年龄：<if condition="$result['requir3'] neq NULL">{$result['requir3']} — {$result['requir4']}周岁</if></span></if>
										<if condition="$result['requir5'] neq NULL">性别：{$result['requir5']}</if>
										</p>
									</if>
									<if condition="$result['reason2'] neq NULL">
										<p>任职资格：</p>{$result['reason2']}
									</if>
								</if>
							</td>
							<td>
								<b>是否后附材料</b>
								<span class="checkbox-item ml10 mr5"><if condition="$result['file2'] eq '否'">{$result['file2']}</if>
								<if condition="$result['file_url2'] neq NULL">
									{$result['file_name2']}<a href="{$result['file_url2']}" target="_blank" data-toggle="tooltip" data-placement="right" title="下载" class="ml5"><i class="glyphicon glyphicon-download-alt mr5"></i></a>
								</if>
								</span>
							</td>
						</tr>
						<tr>
							<td class="title-box"><b>关键业绩指标（KPI）</b></td>
							<td><if condition="$result['reason3'] eq NULL">无<else/>{$result['reason3']}</if></td>
							<td>
								<b>是否后附材料</b>
								<span class="checkbox-item ml10 mr5"><if condition="$result['file3'] eq '否'">{$result['file3']}</if>
								<if condition="$result['file_url3'] neq NULL">
									{$result['file_name3']}<a href="{$result['file_url3']}" target="_blank" data-toggle="tooltip" data-placement="right" title="下载" class="ml5"><i class="glyphicon glyphicon-download-alt mr5"></i></a>
								</if>
								</span>
							</td>
						</tr>
						<tr>
							<td class="title-box"><b>岗位客户</b><span class="input-prompt"><i class="glyphicon glyphicon-exclamation-sign mr5"></i><em style="font-style:normal;">岗位人员对接的对象（如人力资源部/招聘专员岗：对接各事业部人员等）</em></span></td>
							<td colspan="2"><if condition="$result['reason4'] eq NULL">无<else/>{$result['reason4']}</if></td>
						</tr>
						<tr>
							<td class="title-box"><b>岗位出勤率</b><span class="input-prompt"><i class="glyphicon glyphicon-exclamation-sign mr5"></i><em style="font-style:normal;">说明同岗位已有人员前3~6个月出勤率情况/新增岗位填写无，需员工关系组确认</em></span></td>
							<td colspan="2"><if condition="$result['reason5'] eq NULL">无<else/>{$result['reason5']}</if></td>
						</tr>
					</table>
					<if condition="$result['status'] neq -1 or $result['dh_uid'] neq NULL or $result['submit_info'] neq NULL">
						<div class="form-sub-title">审核流程</div>
						<if condition="$result['status'] neq -1">
						<foreach name="audit_user" item="vo">
							<div class="form-item clearfix">
								<div class="input-label">{$vo['audit_name']}</div>
								<div class="input-item">
									<if condition="$vo['audit_date'] neq NULL">
										{$vo['audit_user']}({$vo['audit_date']|substr=0,10})<if condition="$vo['audit_comments'] neq NULL">:{$vo['audit_comments']}</if><if condition="$vo['dh_message'] neq NULL"><br/><span>打回至"{$vo['arrive_name']}"({$vo['dh_date']|substr=0,10})原因:{$vo['dh_message']}</span></if><if condition="$vo['arrive_info'] neq NULL"><br/><span>"{$vo['arrive_name']}"({$vo['arrive_date']|substr=0,10})回复:{$vo['arrive_info']}</span></if>
									<else/>
										<span class='red'>[未审核]{$vo['audit_user']}</span><if condition="$vo['dh_message'] neq NULL"><br/><span class='red'>打回至"{$vo['arrive_name']}"({$vo['dh_date']|substr=0,10})原因:{$vo['dh_message']}</span></if><if condition="$vo['arrive_info'] neq NULL"><br/><span class='red'>"{$vo['arrive_name']}"({$vo['arrive_date']|substr=0,10})回复:{$vo['arrive_info']}</span></if>
									</if>
								</div>
							</div>
						</foreach>
						</if>
						<!--<if condition="$result['dh_uid'] neq NULL">
							<div class="form-item clearfix">
								<div class="item-float">
									<div class="input-label"><span class="red">打回原因</span></div>
									<div class="input-item">
										<span class="red">{$result['dh_user']}({$result['dh_date']|substr=0,10}):{$result['dh_message']}</span>
									</div>
								</div>
							</div>
						</if>
						<if condition="$result['submit_info'] neq NULL">
							<div class="form-item clearfix">
								<div class="item-float">
									<div class="input-label"><span class="red">重新提交</span></div>
									<div class="input-item">
										<span class="red">{$result['submit_user']}:{$result['submit_info']}</span>
									</div>
								</div>
							</div>
						</if>-->
					</if>
				</div>
			</div>
			<div class="form-btn-item">
			<if condition="$audit neq ''">
				<if condition="$result['status'] egt 0">
					<if condition="($shenhe eq 1)">
						<button status="{$result['status']}" mid="{$result['id']}" uuid="{$login_id}" class="btn btn-audit2 mr5" type="button">审核</button>
						<button status="-1" mid="{$result['id']}" uuid="{$login_id}" class="btn btn-back mr5" type="button">打回</button>
					</if>
					<if condition="($qishen eq 1) and ($result['status'] neq 6)">
						<button status="{$result['status']}" mid="{$result['id']}" class="btn btn-giveup mr5" type="button">弃审</button>
					</if>
				</if>
			<else />
			<button class="btn btn-default goback" type="button">返回</button>
			</if>
			</div>
		</form>
	</div>
</div>
<!--重新提交框-->
<div class="modal fade" id="myModal_submit">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<h4>重新提交</h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<div class="modal-body">
				<table class="table table-bordered">
					<tr>
						<td class="text-right" width="74"><strong><span class="asterisk">*</span>原因</strong></td>
						<td>
							<textarea name="remark" placeholder="重新提交理由" class="form-control w300 submit_info left" style="width:100%; height:150px" autocomplete="off"></textarea>
							<span class="error-item left">必填项</span>
						</td>
					</tr>
				</table>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-affirm4">确认</button>
				<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			</div>
		</div>
	</div>
</div>
<!--弹框-->
<div class="modal fade" id="edit-modal">
	<div class="modal-dialog w600">
		<div class="modal-content">
			<div class="modal-header">
				<h4></h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<div class="modal-body" style="line-height:30px;">
				<table class="table table-bordered">
					<tr>
						<td class="text-right" width="74"><strong><span class="asterisk">*</span>审核</strong></td>
						<td>
							<textarea name="text_hid" class="form-control required-text" style="width:100%; height:150px" autocomplete="off"></textarea>
							<input type="hidden" name="audit_message">
							<span class="error-item">必填项</span>
						</td>
					</tr>
				</table>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-affirm5">确认</button><button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			</div>
		</div>
	</div>
</div>
<!--打回弹框-->
<div class="modal fade" id="back-modal">
	<div class="modal-dialog w600">
		<div class="modal-content">
			<div class="modal-header">
				<h4></h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<div class="modal-body" style="line-height:30px;">
				<table class="table table-bordered">
					<tr>
						<td class="text-right" width="95"><strong><span class="asterisk">*</span>打回阶段</strong></td>
						<td>
							<select name="arrive_status" class="form-control required-selted" autocomplete="off">
								<option value="-10" selected>请选择</option>
								<foreach name="audit_list" item="vo">
									<option value="{$vo['audit_sort']}">{$vo['audit_name']}</option>
								</foreach>
							</select>
							<span class="error-item">必填项</span>
						</td>
					</tr>
					<tr>
						<td class="text-right" width="95"><strong><span class="asterisk">*</span>是否重走流程</strong></td>
						<td class="radios">
							<label class="radio-inline"><input type="radio" name="flow_status" value="1" autocomplete="off">是</label>
							<label class="radio-inline"><input type="radio" name="flow_status" value="-1" autocomplete="off">否</label>
							<span class="error-item">必填项</span>
						</td>
					</tr>
					<tr>
						<td class="text-right" width="95"><strong><span class="asterisk">*</span>打回原因</strong></td>
						<td>
							<textarea name="dh_message" class="form-control required-text1" style="width:100%; height:150px" autocomplete="off"></textarea>
							<span class="error-item">必填项</span>
						</td>
					</tr>
				</table>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-affirm6">确认</button><button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			</div>
		</div>
	</div>
</div>
<!--提交框-->
<div class="modal fade" id="affirm-modal">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<h4>确认提示</h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<div class="modal-body">
				你确定存档并完结该单据吗？
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-affirms">确认</button>
				<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			</div>
		</div>
	</div>
</div>
<include file="Include:javascript" />
<script type="text/javascript">
$(function(){
	
	//文本域暂存
	$("[name='text_hid']").blur(function(){
		var val = $(this).val();
			reg = new RegExp("\n", "g"),
    		str = val.replace(reg, "<br/>");
		$("[name='audit_message']").val(str);
	})
	//审核弹框
	$(".btn-audit2").on("click",function(){
		var modal = $("#edit-modal"),
			mid = $(this).attr("mid"),
			uuid = $(this).attr("uuid"),
			status = parseInt($(this).attr('status'))+1;
		if(status==6){
			$('#affirm-modal').modal();
			$('.btn-affirms').attr("mid",mid);
			$('.btn-affirms').attr("uuid",uuid);
		}else{
			modal.find(".modal-header h4").text("审核");
			modal.find(".file-name").prop("readonly",true);
			modal.find(".file-delete").hide();
			modal.find(".btn-affirm5").attr({"mid":mid});
			modal.find(".btn-affirm5").attr({"uuid":uuid});
			modal.find(".btn-affirm5").attr({"status":status});
			modal.modal();
			modal.find("textarea").val('');
		}
	});
	$('.btn-affirms').click(function(){
		var mid = $(this).attr("mid"),
			uuid = $(this).attr("uuid");

		$.ajax({
			cache:true,
			type:"POST",
			dataType:"json",
			url:"__APP__/Index/audit_list_ajax",
			data:{"mid":mid,"status":6,"uuid":uuid,"state":1},
			success:function(data){
				success_pop(data['status'],data['msg']);
			}
		});
	})
	//取消
	$("#edit-modal").on('hidden.bs.modal',function(){
		$(this).find(".error-item").hide();
	});
	$("#edit-modal").find(".btn-affirm5").on("click",function(){
		var tag = false;
		$("[name='text_hid']").each(function(){
			var val = $(this).val();
			if(val=="" || /^\s+$/.test(val)){
				$(this).nextAll(".error-item").show();
				tag = true;
			}
		});
		
		if(tag){
			return false;
		}else{
			var mid = $(this).attr("mid"),
				uuid = $(this).attr("uuid"),
				status = $(this).attr("status"),
				audit_message = $("[name='audit_message']").val(),
				modal = $("#edit-modal");
			modal.hide();
			$.ajax({
				type:"POST",
				async:false,
				dataType:"json",
				data:{"mid":mid,"audit_message":audit_message,"uuid":uuid,"status":status,"type":"7"},
				url:"__APP__/Index/audit_list_ajax",
				success:function(data){
					success_pop(data.status,data.msg);
				}
			});
		}
	});
	$(document).on("focus",".required-text",function(){
		$(this).nextAll(".error-item").hide();
	});
	//弃审
	$('.btn-giveup').on("click",function(){
		var status = $(this).attr('status'),
			mid = $(this).attr("mid");
		$.ajax({
			cache:true,
			type:"POST",
			dataType:"json",
			url:"__APP__/Index/audit_list_ajax",
			data:{"mid":mid,"status":status,"type":"7"},
			success:function(data){
				success_pop(data['status'],data['msg']);
			}
		});
	});
	//打回
	$(".btn-back").on("click",function(){
		var modal = $("#back-modal"),
			mid = $(this).attr("mid"),
			uuid = $(this).attr("uuid"),
			status = $(this).attr("status");
		modal.find(".modal-header h4").text("打回");
		modal.find(".file-name").prop("readonly",true);
		modal.find(".file-delete").hide();
		modal.find(".btn-affirm6").attr({"mid":mid});
		modal.find(".btn-affirm6").attr({"uuid":uuid});
		modal.find(".btn-affirm6").attr({"status":status});
		modal.modal();
		modal.find("textarea").val('');
		modal.find("[name='arrive_status']").val('-10').select2();
		modal.find("[name='flow_status']").attr('checked',false);
	});
	//取消
	$("#back-modal").on('hidden.bs.modal',function(){
		$(this).find(".error-item").hide();
	});
	$("#back-modal").find(".btn-affirm6").on("click",function(){
		var tag = false;
		$(".required-text1").each(function(){
			var val = $(this).val();
			if(val=="" || /^\s+$/.test(val)){
				$(this).next(".error-item").show();
				tag = true;
			}
		});
		$("[name='arrive_status']").each(function(){
			var val = $(this).val();
			if(val==-10){
				$(this).nextAll(".error-item").show();
				tag = true;
			}
		})
		if($("#back-modal").find("input:radio:checked").length==0){
			$("#back-modal .radios").find(".error-item").show();
			tag = true;
		}
		if(tag){
			return false;
		}else{
			var modal = $("#back-modal"),
				mid = $(this).attr("mid"),
				uuid = $(this).attr("uuid"),
				status = $(this).attr("status"),
				dh_status = "{$result['status']}",
				dh_message = $("[name='dh_message']").val(),
				arrive_status = $("[name='arrive_status']").val(),
				flow_status = modal.find('input:radio:checked').val();
				
			modal.hide();
			$.ajax({
				type:"POST",
				async:false,
				dataType:"json",
				data:{"mid":mid,"dh_message":dh_message,"uuid":uuid,"status":status,"flow_status":flow_status,"arrive_status":arrive_status,"dh_status":dh_status},
				url:"__APP__/Index/audit_list_ajax",
				success:function(data){
					success_pop(data['status'],data['msg']);
				}
			});
		}
	});
	$(document).on("focus",".required-text1",function(){
		$(this).nextAll(".error-item").hide();
	});
	$("[name='arrive_status']").change(function(){
		$(this).nextAll(".error-item").hide();
	})
	$("#back-modal .radios label").click(function(){
		$("#back-modal .radios .error-item").hide();
	})
});
</script>
</body>
</html>